package com.fancylargo.crowd.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.fancylargo.crowd.entity.UmsMemberLoginLogEntity;
import com.fancylargo.crowd.service.UmsMemberLoginLogService;
import com.fancylargo.crowd.common.utils.PageUtils;
import com.fancylargo.crowd.common.Result.Result;


/**
 * 会员登录记录
 *
 * @author chaigq
 * @email 15532050839@163.com
 * @date 2020-07-05 19:38:42
 */
@RestController
@RequestMapping("ware/umsmemberloginlog")
public class UmsMemberLoginLogController {
    @Autowired
    private UmsMemberLoginLogService umsMemberLoginLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("crowd:umsmemberloginlog:list")
    public Result list(@RequestParam Map<String, Object> params) {
        PageUtils page = umsMemberLoginLogService.queryPage(params);

        return Result.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("crowd:umsmemberloginlog:info")
    public Result info(@PathVariable("id") Long id) {
        UmsMemberLoginLogEntity umsMemberLoginLog = umsMemberLoginLogService.getById(id);

        return Result.ok().put("umsMemberLoginLog", umsMemberLoginLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("crowd:umsmemberloginlog:save")
    public Result save(@RequestBody UmsMemberLoginLogEntity umsMemberLoginLog) {
        umsMemberLoginLogService.save(umsMemberLoginLog);

        return Result.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("crowd:umsmemberloginlog:update")
    public Result update(@RequestBody UmsMemberLoginLogEntity umsMemberLoginLog) {
        umsMemberLoginLogService.updateById(umsMemberLoginLog);

        return Result.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("crowd:umsmemberloginlog:delete")
    public Result delete(@RequestBody Long[] ids) {
        umsMemberLoginLogService.removeByIds(Arrays.asList(ids));

        return Result.ok();
    }

}
